#include <bits/stdc++.h>
using namespace std;
#define mm(a) memset(a,0,sizeof(a));

typedef long long ll;
ll num = 59084709587505;
vector<int> sum = {3, 5, 7};
int main() {
    set<ll> st;
    ll f = 1;
    while (true) {
        for (int i = 0; i < 3; i++) {
            if (f * sum[i] <= num) {
                st.insert(f * sum[i]);
            }
        }
        f = *st.upper_bound(f);
        if (f >= num) break;
    }
    cout << st.size() << endl;
    return 0;
}
